<template>
  <h1>猜数字练习</h1><br>
  <input type="text" placeholder="请输入数字" v-model="num">
  <button @click="guess">猜一猜</button>
  <h3>小提升:{{ result }}</h3>
</template>

<script setup>

import { ref } from 'vue';
const isShow = ref(false);
const result = ref('');
const num = ref('');
const num1 = ref(parseInt(Math.random()*100)+1);
console.log(num1.value);
const guess =()=>{
  if (num.value < num1.value){
    result.value='猜小了';
  }else if (num.value > num1.value){
    result.value='猜大了';
  }else {
    result.value='恭喜你猜对了';
  }
}

</script>


<style scoped>

</style>